package com.wdf.bean;





import com.wdf.dota.R;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.text.Spanned;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class Dota2EquipmentDialog extends Dialog {

    Context context;
   

    private Spanned content;
    
    private Spanned name;
    
    private Spanned price;
    
    private Spanned reel;
    
    private Bitmap itemImage;
    
    private String action;
    
    private android.view.View.OnClickListener listener;
    
    private int width;
    
    private int height;
    private Window window = null;  
    
    
    public Bitmap getItem_childimage1() {
		return item_childimage1;
	}
	public void setItem_childimage1(Bitmap item_childimage1) {
		this.item_childimage1 = item_childimage1;
	}
	public Spanned getChildimage1name() {
		return childimage1name;
	}
	public void setChildimage1name(Spanned childimage1name) {
		this.childimage1name = childimage1name;
	}
	public Spanned getChildimage1price() {
		return childimage1price;
	}
	public void setChildimage1price(Spanned childimage1price) {
		this.childimage1price = childimage1price;
	}
	public Bitmap getItem_childimage2() {
		return item_childimage2;
	}
	public void setItem_childimage2(Bitmap item_childimage2) {
		this.item_childimage2 = item_childimage2;
	}
	public Spanned getChildimage2name() {
		return childimage2name;
	}
	public void setChildimage2name(Spanned childimage2name) {
		this.childimage2name = childimage2name;
	}
	public Spanned getChildimage2price() {
		return childimage2price;
	}
	public void setChildimage2price(Spanned childimage2price) {
		this.childimage2price = childimage2price;
	}
	public Bitmap getItem_childimage3() {
		return item_childimage3;
	}
	public void setItem_childimage3(Bitmap item_childimage3) {
		this.item_childimage3 = item_childimage3;
	}
	public Spanned getChildimage3name() {
		return childimage3name;
	}
	public void setChildimage3name(Spanned childimage3name) {
		this.childimage3name = childimage3name;
	}
	public Spanned getChildimage3price() {
		return childimage3price;
	}
	public void setChildimage3price(Spanned childimage3price) {
		this.childimage3price = childimage3price;
	}
	private Bitmap item_childimage1;
	private Spanned childimage1name;
    private Spanned childimage1price;
    
    private Bitmap item_childimage2;
    private Spanned childimage2name;
    private Spanned childimage2price;
    
    private Bitmap item_childimage3;
    private Spanned childimage3name;
    private Spanned childimage3price;
    
    private Bitmap item_childimage4;
    private Spanned childimage4name;
    private Spanned childimage4price;
    
    public Dota2EquipmentDialog(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
        this.context = context;
    }
    public Dota2EquipmentDialog(Context context, int theme){
        super(context, theme);
        this.context = context;
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.dota2_equi_dialog);
    
		if(content !=null){
			TextView contentView = (TextView)findViewById(R.id.dialog_content_view);
			contentView.setText(content);
		}
		
		if(name !=null){
			TextView nameView = (TextView)findViewById(R.id.item_name);
			nameView.setText(name);
		}
		
		if(price !=null){
			TextView priceView = (TextView)findViewById(R.id.item_price);
			priceView.setText(price);
		}
		
		
		if(reel !=null){
			TextView priceView = (TextView)findViewById(R.id.item_reel);
			priceView.setText(reel);
		}
      
		if(itemImage !=null){
			ImageView image =  (ImageView)findViewById(R.id.item_image);
			image.setImageBitmap(itemImage);
		}
		
		//改动sssssssssssssssssssssss
		if (item_childimage1!=null) {
			LinearLayout ll = (LinearLayout)findViewById(R.id.item_need_linearlayout);
			ll.setVisibility(View.VISIBLE);
			
			ImageView image =  (ImageView)findViewById(R.id.item_childimage1);
			image.setImageBitmap(item_childimage1);
		}else{
			
		}
		
		if (item_childimage2!=null) {
			ImageView image =  (ImageView)findViewById(R.id.item_childimage2);
			image.setImageBitmap(item_childimage2);
		}
		if (item_childimage3!=null) {
			ImageView image =  (ImageView)findViewById(R.id.item_childimage3);
			image.setImageBitmap(item_childimage3);
		}
		if (item_childimage4!=null) {
			ImageView image =  (ImageView)findViewById(R.id.item_childimage4);
			image.setImageBitmap(item_childimage4);
		}
		
		if (childimage1name!=null) {
			TextView childnameView = (TextView)findViewById(R.id.childimage1name);
			childnameView.setText(childimage1name);
		}
		if (childimage2name!=null) {
			TextView childnameView = (TextView)findViewById(R.id.childimage2name);
			childnameView.setText(childimage2name);
		}
		if (childimage3name!=null) {
			TextView childnameView = (TextView)findViewById(R.id.childimage3name);
			childnameView.setText(childimage3name);
		}
		if (childimage4name!=null) {
			TextView childnameView = (TextView)findViewById(R.id.childimage4name);
			childnameView.setText(childimage4name);
		}
		
		if (childimage1price!=null) {
			TextView childpriceView = (TextView)findViewById(R.id.childimage1price);
			childpriceView.setText(childimage1price);
		}
		if (childimage2price!=null) {
			TextView childpriceView = (TextView)findViewById(R.id.childimage2price);
			childpriceView.setText(childimage2price);
		}
		if (childimage3price!=null) {
			TextView childpriceView = (TextView)findViewById(R.id.childimage3price);
			childpriceView.setText(childimage3price);
		}
		if (childimage4price!=null) {
			TextView childpriceView = (TextView)findViewById(R.id.childimage4price);
			childpriceView.setText(childimage4price);
		}
		//改动ssssssssssssssssssssssss
		
		Button myPositiveButton = (Button)findViewById(R.id.dialog_button_ok);
		myPositiveButton.setText(action);
		myPositiveButton.setOnClickListener( listener);
		
		window =getWindow();
		
        Display display = window.getWindowManager().getDefaultDisplay();
        WindowManager.LayoutParams wl = window.getAttributes();  

         wl.width =(9*display.getWidth()/10);  
         wl.height =(2*display.getHeight())/3;  

        wl.gravity =Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL;  
        window.setAttributes(wl);  
        window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  WindowManager.LayoutParams.FLAG_FULLSCREEN);
        
        
    }

    
    public void setProperty(int x,int y,int w,int h) {  
    
    	  width = w;
          height = h;
     }
    
    public void setProperty(int w,int h) {  
         width = w;
         height = h;
       }
    
    
	public void myHandler(View view) {

		switch (view.getId()) {
		case R.id.dialog_button_ok:
			
			super.dismiss();
			
			break;
		}
	}

	

	
	public Spanned getContent() {
		return content;
	}
	public void setContent(Spanned content) {
		this.content = content;
	}
	public void setPositiveButton(String action, final android.view.View.OnClickListener listener){
		 this.action = action;
		 this.listener = listener;
	}
	
	

	public void cancel(){
		
	}
	public Bitmap getItemImage() {
		return itemImage;
	}
	public void setItemImage(Bitmap itemImage) {
		this.itemImage = itemImage;
	}
	public Spanned getName() {
		return name;
	}
	public void setName(Spanned name) {
		this.name = name;
	}
	public Spanned getPrice() {
		return price;
	}
	public void setPrice(Spanned price) {
		this.price = price;
	}
	public Spanned getReel() {
		return reel;
	}
	public void setReel(Spanned reel) {
		this.reel = reel;
	}
	public Bitmap getItem_childimage4() {
		return item_childimage4;
	}
	public void setItem_childimage4(Bitmap item_childimage4) {
		this.item_childimage4 = item_childimage4;
	}
	public Spanned getChildimage4name() {
		return childimage4name;
	}
	public void setChildimage4name(Spanned childimage4name) {
		this.childimage4name = childimage4name;
	}
	public Spanned getChildimage4price() {
		return childimage4price;
	}
	public void setChildimage4price(Spanned childimage4price) {
		this.childimage4price = childimage4price;
	}
	
	
	
}